﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Portal.Xml.Utility;

namespace Portal.Systems.Model
{
    public class RoleWorkingWorkflowCls
    {
        public string RoleWorkingWorkflowId;
        public string RoleId;
        public string frkWorkflowControlId;
        public string AssetCode;
        public string Subject;
        public int AllowAccess = 0;
        public string DataLanguage = "";
    }

    public class RoleWorkingWorkflowParser
    {
        public static RoleWorkingWorkflowCls CreateInstance()
        {
            //tao 1 class trang....
            RoleWorkingWorkflowCls oRoleWorkingWorkflowCls = new RoleWorkingWorkflowCls();
            return oRoleWorkingWorkflowCls;
        }

        public static RoleWorkingWorkflowCls ParseFromXml(string XmlData)
        {
            DataSet ds = XmlUtility.GetDataSetFromXml(XmlData);
            RoleWorkingWorkflowCls oRoleWorkingWorkflowCls = ParseFromDataRow(ds.Tables[0].Rows[0]);
            return oRoleWorkingWorkflowCls;
        }


        public static RoleWorkingWorkflowCls ParseFromDataRow(DataRow dr)
        {
            RoleWorkingWorkflowCls ORoleWorkingWorkflowCls = new RoleWorkingWorkflowCls();
            ORoleWorkingWorkflowCls.RoleWorkingWorkflowId = XmlUtility.GetString(dr, "RoleWorkingWorkflowId", true); 
            ORoleWorkingWorkflowCls.RoleId = XmlUtility.GetString(dr, "RoleId", true); 
            ORoleWorkingWorkflowCls.frkWorkflowControlId = XmlUtility.GetString(dr, "frkWorkflowControlId", true); 
            ORoleWorkingWorkflowCls.AssetCode = XmlUtility.GetString(dr, "AssetCode", true);
            ORoleWorkingWorkflowCls.Subject = XmlUtility.GetString(dr,"Subject",true);
            ORoleWorkingWorkflowCls.DataLanguage = XmlUtility.GetString(dr, "frkDataLanguageId", true);
            ORoleWorkingWorkflowCls.AllowAccess = XmlUtility.GetInt(dr, "AllowAccess", true);
            return ORoleWorkingWorkflowCls;
        }

        public static RoleWorkingWorkflowCls[] ParseFromDataTable(DataTable dtTable)
        {
            RoleWorkingWorkflowCls[] RoleWorkingWorkflows = new RoleWorkingWorkflowCls[dtTable.Rows.Count];
            for (int iIndex = 0; iIndex < dtTable.Rows.Count; iIndex++)
            {
                RoleWorkingWorkflows[iIndex] = ParseFromDataRow(dtTable.Rows[iIndex]);
            }

            return RoleWorkingWorkflows;
        }
    }
}



